const db = require('../../db.js');
const router = require('express').Router();

router.get('/index', (req, res) => {
    db.query(`select * from it_job limit 0,12;
     select * from label;
     select * from ebook where fele = 'BWBO';
     select * from textbook limit 11;
    `, (error, results) => {
        if (error) {
            res.json({
                code: '400',
                message: '查询失败'
            })
        } else {
            res.json({
                code: '200',
                data: {
                    jobList: results[0], //工作
                    bookLabel: results[1], //图书标签
                    bookPic: results[2], //图书图片
                    textbookList: results[3], //教材
                }
            })
        }
    })
})

module.exports = router;